#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    process = new QProcess(this);
    connect(process, SIGNAL(started()), this, SLOT(slotStarted()));
    connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotFinished(int, QProcess::ExitStatus)));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::slotStarted()
{
    qDebug() << process->program() << "已启动，该干嘛干嘛";
}

void MainWindow::slotFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
    qDebug() << process->program() << "已退出，该干嘛干嘛";
}

void MainWindow::on_pushButton_clicked()
{
    QString program = ui->lineEdit->text();
    QStringList argList;
    process->start(program, argList);
}
